package com.ruoyi.orders.mapper;

import java.util.List;
import com.ruoyi.orders.domain.Orders;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 预约订单Mapper接口
 * 
 * @author shz
 * @date 2024-07-17
 */
public interface OrdersMapper 
{
    /**
     * 查询预约订单
     * 
     * @param id 预约订单主键
     * @return 预约订单
     */
    public Orders selectOrdersById(Long id);

    /**
     * 查询预约订单列表
     * 
     * @param orders 预约订单
     * @return 预约订单集合
     */
    public List<Orders> selectOrdersList(Orders orders);

    /**
     * 新增预约订单
     * 
     * @param orders 预约订单
     * @return 结果
     */
    public int insertOrders(Orders orders);

    /**
     * 修改预约订单
     * 
     * @param orders 预约订单
     * @return 结果
     */
    public int updateOrders(Orders orders);

    /**
     * 删除预约订单
     * 
     * @param id 预约订单主键
     * @return 结果
     */
    public int deleteOrdersById(Long id);

    /**
     * 批量删除预约订单
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOrdersByIds(Long[] ids);


    @Select("SELECT count(*) from orders WHERE startDate=#{startDate} AND status=#{status}")
    int selectYuCount(@Param("startDate")String startDate, @Param("status")Integer status);


    @Select("SELECT IFNULL(SUM(price), 0) AS sum FROM orders WHERE gmtPayment BETWEEN #{startDate} AND #{endDate}")
    int getTotalProfitAndPublishDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
}
